package config

import (
	"gorm.io/gorm"
)

type Mysql struct {
	Host     string
	Port     string
	Username string
	Password string
	Database string
}

func (mysql *Mysql) Dsn() string {
	dsn := GLOBAL_CONFIG.Mysql.Username + ":" + GLOBAL_CONFIG.Mysql.Password + "@tcp(" +
		GLOBAL_CONFIG.Mysql.Host + ":" + GLOBAL_CONFIG.Mysql.Port + ")/" + GLOBAL_CONFIG.Mysql.Database +
		"?charset=utf8mb4&parseTime=True&loc=Local"

	return dsn
}

var DB_MYSQL *gorm.DB
